import { request } from '../plugins/axios.js';

// 获取角色列表
export function list() {
  return request({
    method: 'GET',
    url: 'roles',
  });
}

// 删除某角色的某权限
export function delRight(roleId, rightId) {
  return request({
    method: 'DELETE',
    url: `roles/${roleId}/rights/${rightId}`,
  });
}

// 为角色分配权限
export function allocRights(roleId, rightIdsStr) {
  return request({
    method: 'POST',
    url: `roles/${roleId}/rights`,
    data: {
      rids: rightIdsStr,
    },
  });
}
